﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using XbdSoft.Client;
using XbdSoft.Contract;
using XbdSoft.Domain;

namespace XbdSoft
{
    public partial class XbdMP3CustDownload : DockContent
    {
        public XbdMP3CustDownload()
        {
            InitializeComponent();
        }

        private void XbdMP3CustDownload_Load(object sender, EventArgs e)
        {
            BindGridView();
        }

        protected void BindGridView()
        {
            var allResources = new List<AudioResource>();
            using (var downloadService = new ServiceObject<IDownloadService>(Util.DownloadServiceAddress))
            {
                var allRecommends = downloadService.Object.GetRecommendDownloadCategories();
                allRecommends.ForEach(r => {
                    allResources.AddRange(r.AudioResources);
                });
            }
            dataGridView1.DataSource = allResources;
        }
    }
}
